If you're a game developer on Roblox, you might be familiar with the limitations of the platform when it comes to physics. While Roblox does have fantastic physics, the physics engine itself is abstracted from the developers, blocking us from being able to work with it directly. To avoid unpredicdable results and create a buttery smooth character controller, we'll be incorporating our own character controller physics from the ground up. In this article, we will talk about creating B-Hop (Source engine character controller physics), which offers a unique way of movement and speed in games.
The first rule of developing in Roblox is to not use any of the tools offered to you. It sounds hilarious and I might be exxagerating a little bit, but seriously, Roblox does a lot of things wrong and I'd rather not build code on top of incorrect constructs. For the most part, Roblox should strictly be used as a renderer (but utilize the network features, of course), and with this being said, you must make your own physics from scratch. Roblox offers various functions to locate geometry within the space with concepts such as rays and regions. Once you figure out how to get collisions to work, you have the fundamentals for a rigid body collider. You can then apply forces to it and move it in whatever way you'd like.
But how does the B-Hop physics system work in Source engine? The secret lies in the direction of the plane of freedom. Your inputs determine the direction of the plane of freedom in your movement. If you're pressing the A key (to the left), then your plane will be facing to the left. Upon moving your camera to the left, your plane will begin to divert your direction to the left. This goes for all directions: you can think of your plane as a literal surface that your controller is hitting, allowing you to divert direction.
To gain speed, players exploit a phenomenon known as error accumulation. During physics steps, a player will gain speed due to the accumulated errors between steps. This error becomes a significant factor in gaining speed in a game like B-Hop. However it's important to note that there's a sweet spot for maximizing this error, if you rotate too slowly or too fast, then the speed increase will be neglible to none. But if you turn at just the correct rate, you can maximize your speed increase.
FILES CONTAINED IN THIS PLOG* B-Hop Physics.plg* jump test.mp4 * strafe.mp4 * wall run.mp4 |